# == Schema Information
#
# Table name: customers
#
#  id            :integer          not null, primary key
#  name          :string(255)
#  short_name    :string(255)
#  master_mobile :string(255)
#  master_name   :string(255)
#  status        :integer          default(1)
#  active        :boolean          default(TRUE)
#  created_at    :datetime         not null
#  updated_at    :datetime         not null
#

class Customer < ApplicationRecord
  validates_uniqueness_of :name, message: '企业名已被注册！'
  # validates_uniqueness_of :short_name, message: '企业简称已被注册！'
  has_many :users, class_name: 'Base::User', foreign_key: :customer_id


  def to_s
    name
  end

  def self.current
    Base::Session.current_customer
  end

end
